#include "菜单.h"

HMENU 创建主窗顶部菜单(HWND 父窗口句柄)
{
	HMENU 主窗顶部菜单 = CreateMenu();
	HMENU 文件 = CreatePopupMenu();
	HMENU 文件_新建 = CreatePopupMenu();
	HMENU 文件_打开 = CreatePopupMenu();
	HMENU 编辑 = CreatePopupMenu();
	if(!主窗顶部菜单)
	{
		return NULL;
	}
	AppendMenu(主窗顶部菜单,   MF_POPUP,                (UINT_PTR)文件,                    "文件");
	AppendMenu(文件,         MF_POPUP ,               (UINT_PTR)文件_新建,                "新建");/*有子菜单的*/
	AppendMenu(文件_新建,     MF_STRING,               (UINT)菜单_顶部_文件_新建_C项目,        "C/Z项目");
	AppendMenu(文件_新建,     MF_SEPARATOR,             0,                                "");
	AppendMenu(文件_新建,     MF_STRING,               (UINT)菜单_顶部_文件_新建_文件夹,        "文件夹");
	AppendMenu(文件,         MF_POPUP ,               (UINT_PTR)文件_打开,                "打开");
	AppendMenu(文件_打开,     MF_STRING,               (UINT)菜单_顶部_文件_打开_文件,        "文件");
	AppendMenu(文件_打开,     MF_SEPARATOR,             0,                                "");
	AppendMenu(文件_打开,     MF_STRING,               (UINT)菜单_顶部_文件_打开_项目,         "项目");
	AppendMenu(文件,         MF_STRING | MF_CHECKED,  (UINT)菜单_顶部_文件_退出,           "退出");

    AppendMenu(主窗顶部菜单,   MF_POPUP,                (UINT_PTR)编辑,                   "编辑");
    AppendMenu(编辑,         MF_STRING ,              1004,                            "恢复");
    AppendMenu(编辑,         MF_SEPARATOR,             0,                               "");
    AppendMenu(编辑,         MF_STRING | MF_CHECKED,   1005,                           "重做");

	SetMenu(父窗口句柄, 主窗顶部菜单);
	ShowWindow((HWND)主窗顶部菜单, SW_SHOW);
	UpdateWindow((HWND)主窗顶部菜单);
	return 主窗顶部菜单;
}
